package com.example.thrive;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;

import android.util.Log;
import android.widget.EditText;

public class ConnectToDatabase {
	
	
	 public void ConnectToTheDatabase(){
	     try {
	  
	          // SET CONNECTIONSTRING
	          Class.forName("net.sourceforge.jtds.jdbc.Driver").newInstance();
	          String username = "XXXXXXXXX";
	             String password = "XXXXXX";
	          Connection DbConn = DriverManager.getConnection("jdbc:jtds:sqlserver://192.188.4.83:1433/DATABASE;user=" + username + ";password=" + password);
	  
	          Log.w("Connection","open");
	         Statement stmt = DbConn.createStatement();
	         ResultSet reset = stmt.executeQuery(" select * from Problematik");
	  

	   //       EditText num = (EditText) findViewById(R.id.displaymessage);
	   //      num.setText(reset.getString(1));
	  
	         DbConn.close();
	  
	         } catch (Exception e)
	         {
	         Log.w("Error connection","" + e.getMessage());
	         }
	 }

	private EditText findViewById(Object displaymessage) {
		// TODO Auto-generated method stub
		return null;
	}

}
